package com.jorigin.util;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @author lizq
 */
public class ChooseUtil {
    
    /**
     *  1107568
     * 11/3 = 165*55*11*6  = 99825*6(6种人工排除2种，根据出3个号的区域做排除) = 598950，（如果买复式，每个区选3个号，9选6 = 84*2=168元）
     * @return
     * @throws NoSuchAlgorithmException
     */
    public static int randomOne() throws NoSuchAlgorithmException {
        Random rd = SecureRandom.getInstanceStrong();
        return rd.nextInt(598950);
    }
    public static void main(String[] args) throws NoSuchAlgorithmException {
        List<Integer> li = new ArrayList<>();
        for (int i = 0; i < 598950; i++) {
            Integer ii = ChooseUtil.randomOne();
            if (li.contains(ii)) {
                System.out.println(i+"="+ii);
            }else {
                li.add(ii);
            }
        }
    }
}
